<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core">
	<head><title>IGNORED</title></head>
    <body>
		<ui:composition template="../templates/layout.xhtml">
			<ui:define name="windowTitle">Daily Market | Administrator Console | Manage Clients</ui:define>
			<ui:define name="logoImage"><h:graphicImage library="images" name="logo_header.jpg" alt="logo" /></ui:define>
			<ui:define name="navigation"></ui:define>
			<ui:define name="content">
				<div id="content" class="graphic_bg">
					<h:form>
						<div class="form-row header">#{userListBean.existingClient ? "Edit Client Profile" : "Create New Client"}</div>
						<div class="form-row">
							<h:outputLabel for="newClient_email" styleClass="form-row">Email:</h:outputLabel>
							<h:inputText id="newClient_email" value="#{userListBean.editableUser.clientID}" required="true" requiredMessage="#{msgs.email_invalid_detail}" validator="#{authenticationBean.validateEmail}" rendered="#{not userListBean.existingClient}" />
							<h:outputText id="oldClient_email" value="#{userListBean.editableUser.clientID}" rendered="#{userListBean.existingClient}" style="font-weight: bold;" />
						</div>
						<h:message for="newClient_email" errorClass="form-message error" infoClass="form-message" fatalClass="form-message error" styleClass="form-message" warnClass="form-message warn" />
						<div class="form-row">
							<h:outputLabel for="newClient_password" styleClass="form-row">Password:</h:outputLabel>
							<h:inputText id="newClient_password" value="#{userListBean.editableUser.password}" required="true" requiredMessage="#{msgs.password_invalid}" validatorMessage="#{msgs.password_invalid}" >
								<f:validateLength minimum="6" maximum="20" />
							</h:inputText>
						</div>
						<h:message for="newClient_password" errorClass="form-message error" infoClass="form-message" fatalClass="form-message error" styleClass="form-message" warnClass="form-message warn" />
						<div class="form-row">
							<h:outputLabel for="profileFirstName" styleClass="form-row">First Name:</h:outputLabel>
							<h:inputText id="profileFirstName" value="#{userListBean.editableUser.userProfile.firstName}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileLastName" styleClass="form-row">Last Name:</h:outputLabel>
							<h:inputText id="profileLastName" value="#{userListBean.editableUser.userProfile.lastName}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileCompanyName" styleClass="form-row">Company Name:</h:outputLabel>
							<h:inputText id="profileCompanyName" value="#{userListBean.editableUser.userProfile.companyName}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileAddressLine1" styleClass="form-row">Address Line 1:</h:outputLabel>
							<h:inputText id="profileAddressLine1" value="#{userListBean.editableUser.userProfile.addressLine1}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileAddressLine2" styleClass="form-row">Address Line 2:</h:outputLabel>
							<h:inputText id="profileAddressLine2" value="#{userListBean.editableUser.userProfile.addressLine2}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileAddressCity" styleClass="form-row">City: </h:outputLabel>
							<h:inputText id="profileAddressCity" value="#{userListBean.editableUser.userProfile.addressCity}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileAddressState" styleClass="form-row">State:</h:outputLabel>
							<h:inputText id="profileAddressState" value="#{userListBean.editableUser.userProfile.addressState}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileAddressZip" styleClass="form-row">Zip Code:</h:outputLabel>
							<h:inputText id="profileAddressZip" value="#{userListBean.editableUser.userProfile.addressZipCode}" />
						</div>
						<div class="form-row">
							<h:outputLabel for="profileClientType" styleClass="form-row">Client Type:</h:outputLabel>
							<h:selectOneMenu id="profileClientType" value="#{userListBean.editableUser.clientType}">
								<f:selectItem itemValue="#{userListBean.editableUser.clientTypeAdmin}" itemLabel="Admin" />
								<f:selectItem itemValue="#{userListBean.editableUser.clientTypePartner}" itemLabel="Partner" />
								<f:selectItem itemValue="#{userListBean.editableUser.clientTypeCustomer}" itemLabel="Customer" />
							</h:selectOneMenu>
						</div>
						<div class="form-row submit">
							<h:link styleClass="image-button" outcome="manage_clients">Cancel</h:link>
							<h:commandLink styleClass="image-button" action="#{userListBean.doSaveClient}">Save</h:commandLink>
						</div>
						<h:messages globalOnly="true" styleClass="form-messages" fatalClass="form-messages error" errorClass="form-messages error" warnClass="form-messages warn" infoClass="form-messages good" />
					</h:form>
				</div>
			</ui:define>
		</ui:composition>
	</body>
</html>